const express = require('express');
const userRoutes = require('./userRoutes');
const gameRoutes = require('./gameRoutes');
const leaderboardRoutes = require('./leaderboardRoutes');

const router = express.Router();

// API 路由
router.use('/api/users', userRoutes);
router.use('/api/games', gameRoutes);
router.use('/api/leaderboard', leaderboardRoutes);

// 健康检查路由
router.get('/health', (req, res) => {
  res.status(200).json({ status: 'ok', message: '服务运行正常' });
});

// 404 处理
router.use('*', (req, res) => {
  res.status(404).json({ error: '路由不存在' });
});

module.exports = router;
